--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  /Volumes/JSS/Staiger Productivity/stage2_hosp_may2014.log
  log type:  text
 opened on:  25 Nov 2014, 11:58:08

. set mem 300m

Current memory allocation

                    current                                 memory usage
    settable          value     description                 (1M = 1024k)
    --------------------------------------------------------------------
    set maxvar        10000     max. variables allowed           4.208M
    set memory          300M    max. data space                300.000M
    set matsize         400     max. RHS vars in models          1.254M
                                                            -----------
                                                               305.462M

. set matsize 800

Current memory allocation

                    current                                 memory usage
    settable          value     description                 (1M = 1024k)
    --------------------------------------------------------------------
    set maxvar        10000     max. variables allowed           4.208M
    set memory          300M    max. data space                300.000M
    set matsize         800     max. RHS vars in models          4.950M
                                                            -----------
                                                               309.158M

. set more off

. /* this global determines the minimum size threshold */
. 
. global cut_ccp=5

. 
. use "/Volumes/JSS/Staiger Productivity/fe_ami_hosp_86_nov07.dta"

. 
. keep if year==1994
(50742 observations deleted)

. destring provider, replace
provider has all characters numeric; replaced as long

. keep provider

. sort provider

. save id_insamp_86, replace
file id_insamp_86.dta saved

. 
. /* now read in the ccp data & create the adoption measures, and limit sample to those insamp */
. clear all

. use "/Volumes/JSS/CCP data/Data/ccp_cohort.dta", clear

. * use "C:\projects\nia\racedif\chandra4.dta", clear
. 
. 
. sort provider

. merge provider using id_insamp_86
(note: you are using old merge syntax; see [D] merge for new syntax)
variable provider does not uniquely identify observations in the master data
provider was float now double

. tab _merge

     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |     23,197       14.19       14.19
          2 |          7        0.00       14.19
          3 |    140,312       85.81      100.00
------------+-----------------------------------
      Total |    163,516      100.00

. keep if _merge==3
(23204 observations deleted)

. drop _merge

. 
. gen reper12 = max(thr12,ptca12)

. gen latepci=pci30d

. replace latepci=0 if pci30d==1 & ptca12==1
(4837 real changes made)

. gen num_proc=0

. gen num_proc_oth_all=0

. gen num_proc_oth_select=0

. gen cath_index=0

. gen cabg_index=0

. gen pci_index=0

. gen stent_index=0

. forval i=1/6 {
  2. replace num_proc=num_proc+1 if proc`i'!=""
  3. #delimit ;
delimiter now ;
. replace num_proc_oth_all=num_proc_oth_all+1 if proc`i'!="" 
>  & proc`i'!="3601"
>  & proc`i'!="3602"
>  & proc`i'!="3605"
>  & proc`i'!="3606"
>  & proc`i'!="3607"
>  & proc`i'!="3610"
>  & proc`i'!="3611"
>  & proc`i'!="3612"
>  & proc`i'!="3613"
>  & proc`i'!="3614"
>  & proc`i'!="3615"
>  & proc`i'!="3616"
>  & proc`i'!="3617"
>  & proc`i'!="3618"
>  & proc`i'!="3619"
>  & proc`i'!="3721"
>  & proc`i'!="3722"
>  & proc`i'!="3723";
  4. replace num_proc_oth_select=num_proc_oth_select+1 if  
>    proc`i'=="3761"
>  | proc`i'=="3778"
>  | proc`i'=="3954"
>  | proc`i'=="3964"
>  | proc`i'=="9604"
>  | proc`i'=="9671"
>  | proc`i'=="9672"
>  | proc`i'=="9904"
>  ;
  5. replace cath_index=1 if
>    proc`i'=="3721"
>  | proc`i'=="3722"
>  | proc`i'=="3723";
  6. replace cabg_index=1 if
>    proc`i'=="3610"
>  | proc`i'=="3611"
>  | proc`i'=="3612"
>  | proc`i'=="3613"
>  | proc`i'=="3614"
>  | proc`i'=="3615"
>  | proc`i'=="3616"
>  | proc`i'=="3617"
>  | proc`i'=="3618"
>  | proc`i'=="3619";
  7. replace pci_index=1 if
>    proc`i'=="3601"
>  | proc`i'=="3602"
>  | proc`i'=="3605"
>  | proc`i'=="3606"
>  | proc`i'=="3607";
  8. replace stent_index=1 if
>    proc`i'=="3606";
  9.  #delimit cr
delimiter now cr
. }
(89538 real changes made)
(43344 real changes made)
(11062 real changes made)
(21656 real changes made)
(9581 real changes made)
(14957 real changes made)
(15 real changes made)
(71826 real changes made)
(48147 real changes made)
(8898 real changes made)
(19510 real changes made)
(410 real changes made)
(1651 real changes made)
(44 real changes made)
(59356 real changes made)
(51163 real changes made)
(4539 real changes made)
(4382 real changes made)
(137 real changes made)
(575 real changes made)
(10 real changes made)
(38712 real changes made)
(36009 real changes made)
(3682 real changes made)
(1404 real changes made)
(142 real changes made)
(269 real changes made)
(11 real changes made)
(25074 real changes made)
(23173 real changes made)
(3255 real changes made)
(615 real changes made)
(52 real changes made)
(198 real changes made)
(14 real changes made)
(17304 real changes made)
(16311 real changes made)
(2786 real changes made)
(306 real changes made)
(19 real changes made)
(103 real changes made)
(4 real changes made)

. foreach v in $goodstuff $badstuff {
  2.  drop if `v'==.
  3.  }
(331 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)
(0 observations deleted)

. save ccp_temp, replace
file ccp_temp.dta saved

. 
. keep provider $goodstuff $badstuff majteach black rl6inab

. gen nobs=1

. summ

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
       black |    139981    .0537073      .22544          0          1
    majteach |    139981    .2367964    .4251178          0          1
     asahosp |    139981    .7958151    .4031061          0          1
    betahosp |    139981    .4670848    .4989172          0          1
     cabg30d |    139981    .1461413     .353249          0          1
-------------+--------------------------------------------------------
    lidohosp |    139981    .2036348    .4027019          0          1
     rl6inab |    139981    11692.11    1858.994   6904.706   17441.82
    provider |    139981    267504.7    141760.1      10001     530012
     reper12 |    139981     .185218    .3884757          0          1
     latepci |    139981    .1644938    .3707243          0          1
-------------+--------------------------------------------------------
        nobs |    139981           1           0          1          1

. collapse (count) nobs (mean) $goodstuff $badstuff majteach black rl6inab, by(provider)

. sort provider

. 
. keep  if nobs>=$cut_ccp
(47 observations deleted)

. sort provider

. save ccp_hosp_rates, replace
file ccp_hosp_rates.dta saved

. 
. /* estimate factor models with hosp data */
. use ccp_hosp_rates, clear

. /* summary stats unweighted */
. summ 

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
    provider |      2765    261255.9    149056.5      10001     530012
        nobs |      2765    50.57758    44.00672          5        385
     asahosp |      2765    .7775219     .130169          0          1
    betahosp |      2765    .4402605    .1724505          0          1
     reper12 |      2765    .1839383    .1000524          0        .65
-------------+--------------------------------------------------------
     cabg30d |      2765    .1344933    .0823774          0         .6
     latepci |      2765    .1499937    .0939776          0         .5
    lidohosp |      2765    .2051769    .1142332          0          1
    majteach |      2765    .1562387    .3631472          0          1
       black |      2765    .0616476     .119948          0          1
-------------+--------------------------------------------------------
     rl6inab |      2765    11478.88    1779.227   7182.062   17365.94

. /* summary stats weighted */
. summ [aw=nobs]

    Variable |     Obs      Weight        Mean   Std. Dev.       Min        Max
-------------+-----------------------------------------------------------------
    provider |    2765      139847    267565.4   141756.6      10001     530012
        nobs |    2765      139847    88.85325   64.44863          5        385
     asahosp |    2765      139847    .7958626   .1053094          0          1
    betahosp |    2765      139847    .4671963   .1526139          0          1
     reper12 |    2765      139847    .1852882   .0816934          0        .65
-------------+-----------------------------------------------------------------
     cabg30d |    2765      139847    .1462026   .0708722          0         .6
     latepci |    2765      139847    .1645084   .0856161          0         .5
    lidohosp |    2765      139847    .2036154   .0977257          0          1
    majteach |    2765      139847    .2369804   .4253071          0          1
       black |    2765      139847    .0536586    .090525          0          1
-------------+-----------------------------------------------------------------
     rl6inab |    2765      139847    11692.75    1753.51   7182.062   17365.94

. 
. /* do factor analysis in levels */
. factor $goodstuff [aw=nobs], fact(1)
(sum of wgt is   1.3985e+05)
(obs=2765)

Factor analysis/correlation                        Number of obs    =     2765
    Method: principal factors                      Retained factors =        1
    Rotation: (unrotated)                          Number of params =        3

    --------------------------------------------------------------------------
         Factor  |   Eigenvalue   Difference        Proportion   Cumulative
    -------------+------------------------------------------------------------
        Factor1  |      0.67110      0.62989            1.5201       1.5201
        Factor2  |      0.04121      0.31206            0.0934       1.6135
        Factor3  |     -0.27084            .           -0.6135       1.0000
    --------------------------------------------------------------------------
    LR test: independent vs. saturated:  chi2(3)  =  673.13 Prob>chi2 = 0.0000

Factor loadings (pattern matrix) and unique variances

    ---------------------------------------
        Variable |  Factor1 |   Uniqueness 
    -------------+----------+--------------
         asahosp |   0.5874 |      0.6550  
        betahosp |   0.5340 |      0.7149  
         reper12 |   0.2024 |      0.9590  
    ---------------------------------------

. predict f_level1
(regression scoring assumed)

Scoring coefficients (method = regression)

    ------------------------
        Variable |  Factor1 
    -------------+----------
         asahosp |  0.41467 
        betahosp |  0.35242 
         reper12 |  0.11284 
    ------------------------


. /* this shows how factor combines the 3 measures */
. reg f_level1 $goodstuff

      Source |       SS       df       MS              Number of obs =    2765
-------------+------------------------------           F(  3,  2761) =       .
       Model |  1817.53225     3  605.844082           Prob > F      =       .
    Residual |           0  2761           0           R-squared     =  1.0000
-------------+------------------------------           Adj R-squared =  1.0000
       Total |  1817.53225  2764  .657573171           Root MSE      =       0

------------------------------------------------------------------------------
    f_level1 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
     asahosp |   3.937603          .        .       .            .           .
    betahosp |   2.309219          .        .       .            .           .
     reper12 |   1.381249          .        .       .            .           .
       _cons |  -4.468579          .        .       .            .           .
------------------------------------------------------------------------------

. /* this shows how factor is correlated with the 3 measures */
. corr f_level1 $goodstuff [aw=nobs]
(sum of wgt is   1.3985e+05)
(obs=2765)

             | f_level1  asahosp betahosp  reper12
-------------+------------------------------------
    f_level1 |   1.0000
     asahosp |   0.8712   1.0000
    betahosp |   0.7920   0.4294   1.0000
     reper12 |   0.3002   0.1895   0.0311   1.0000


. pwcorr f_level1 $goodstuff [aw=nobs], sig

             | f_level1  asahosp betahosp  reper12
-------------+------------------------------------
    f_level1 |   1.0000 
             |
             |
     asahosp |   0.8712   1.0000 
             |   0.0000
             |
    betahosp |   0.7920   0.4294   1.0000 
             |   0.0000   0.0000
             |
     reper12 |   0.3002   0.1895   0.0311   1.0000 
             |   0.0000   0.0000   0.1023
             |

. 
. factor $badstuff [aw=nobs], fact(1)
(sum of wgt is   1.3985e+05)
(obs=2765)

Factor analysis/correlation                        Number of obs    =     2765
    Method: principal factors                      Retained factors =        1
    Rotation: (unrotated)                          Number of params =        3

    --------------------------------------------------------------------------
         Factor  |   Eigenvalue   Difference        Proportion   Cumulative
    -------------+------------------------------------------------------------
        Factor1  |      0.34211      0.43286            2.8462       2.8462
        Factor2  |     -0.09075      0.04041           -0.7550       2.0912
        Factor3  |     -0.13116            .           -1.0912       1.0000
    --------------------------------------------------------------------------
    LR test: independent vs. saturated:  chi2(3)  =  177.16 Prob>chi2 = 0.0000

Factor loadings (pattern matrix) and unique variances

    ---------------------------------------
        Variable |  Factor1 |   Uniqueness 
    -------------+----------+--------------
         cabg30d |   0.3383 |      0.8856  
         latepci |   0.3567 |      0.8728  
        lidohosp |   0.3170 |      0.8995  
    ---------------------------------------

. predict f_level2
(regression scoring assumed)

Scoring coefficients (method = regression)

    ------------------------
        Variable |  Factor1 
    -------------+----------
         cabg30d |  0.25979 
         latepci |  0.27583 
        lidohosp |  0.24164 
    ------------------------


. /* this shows how factor combines the 3 measures */
. reg f_level2 $badstuff

      Source |       SS       df       MS              Number of obs =    2765
-------------+------------------------------           F(  3,  2761) =       .
       Model |  900.557381     3  300.185794           Prob > F      =       .
    Residual |           0  2761           0           R-squared     =  1.0000
-------------+------------------------------           Adj R-squared =  1.0000
       Total |  900.557381  2764  .325816708           Root MSE      =       0

------------------------------------------------------------------------------
    f_level2 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
     cabg30d |   3.665572          .        .       .            .           .
     latepci |   3.221674          .        .       .            .           .
    lidohosp |   2.472651          .        .       .            .           .
       _cons |  -1.569378          .        .       .            .           .
------------------------------------------------------------------------------

. /* this shows how factor is correlated with the 3 measures */
. corr f_level2 $badstuff [aw=nobs]
(sum of wgt is   1.3985e+05)
(obs=2765)

             | f_level2  cabg30d  latepci lidohosp
-------------+------------------------------------
    f_level2 |   1.0000
     cabg30d |   0.6599   1.0000
     latepci |   0.6957   0.1709   1.0000
    lidohosp |   0.6182   0.1298   0.1508   1.0000


. pwcorr f_level2 $badstuff [aw=nobs], sig

             | f_level2  cabg30d  latepci lidohosp
-------------+------------------------------------
    f_level2 |   1.0000 
             |
             |
     cabg30d |   0.6599   1.0000 
             |   0.0000
             |
     latepci |   0.6957   0.1709   1.0000 
             |   0.0000   0.0000
             |
    lidohosp |   0.6182   0.1298   0.1508   1.0000 
             |   0.0000   0.0000   0.0000
             |

. 
. /* do joint factor model to compare */
. /* could do promax or varimax rotation and get similar results */
. factor $goodstuff $badstuff [aw=nobs], fact(2)
(sum of wgt is   1.3985e+05)
(obs=2765)

Factor analysis/correlation                        Number of obs    =     2765
    Method: principal factors                      Retained factors =        2
    Rotation: (unrotated)                          Number of params =       11

    --------------------------------------------------------------------------
         Factor  |   Eigenvalue   Difference        Proportion   Cumulative
    -------------+------------------------------------------------------------
        Factor1  |      0.93938      0.41913            1.0443       1.0443
        Factor2  |      0.52025      0.53809            0.5783       1.6226
        Factor3  |     -0.01784      0.06750           -0.0198       1.6028
        Factor4  |     -0.08534      0.12352           -0.0949       1.5079
        Factor5  |     -0.20886      0.03916           -0.2322       1.2757
        Factor6  |     -0.24802            .           -0.2757       1.0000
    --------------------------------------------------------------------------
    LR test: independent vs. saturated:  chi2(15) = 1454.87 Prob>chi2 = 0.0000

Factor loadings (pattern matrix) and unique variances

    -------------------------------------------------
        Variable |  Factor1   Factor2 |   Uniqueness 
    -------------+--------------------+--------------
         asahosp |   0.6195   -0.1408 |      0.5964  
        betahosp |   0.4464   -0.3656 |      0.6671  
         reper12 |   0.3030    0.2973 |      0.8198  
         cabg30d |   0.3165    0.1373 |      0.8810  
         latepci |   0.3926    0.1747 |      0.8153  
        lidohosp |   0.1009    0.4786 |      0.7608  
    -------------------------------------------------

. rotate, varimax

Factor analysis/correlation                        Number of obs    =     2765
    Method: principal factors                      Retained factors =        2
    Rotation: orthogonal varimax (Kaiser off)      Number of params =       11

    --------------------------------------------------------------------------
         Factor  |     Variance   Difference        Proportion   Cumulative
    -------------+------------------------------------------------------------
        Factor1  |      0.86497      0.27031            0.9615       0.9615
        Factor2  |      0.59466            .            0.6611       1.6226
    --------------------------------------------------------------------------
    LR test: independent vs. saturated:  chi2(15) = 1454.87 Prob>chi2 = 0.0000

Rotated factor loadings (pattern matrix) and unique variances

    -------------------------------------------------
        Variable |  Factor1   Factor2 |   Uniqueness 
    -------------+--------------------+--------------
         asahosp |   0.6212    0.1334 |      0.5964  
        betahosp |   0.5589   -0.1434 |      0.6671  
         reper12 |   0.1495    0.3973 |      0.8198  
         cabg30d |   0.2292    0.2578 |      0.8810  
         latepci |   0.2825    0.3239 |      0.8153  
        lidohosp |  -0.1102    0.4765 |      0.7608  
    -------------------------------------------------

Factor rotation matrix

    --------------------------------
                 | Factor1  Factor2 
    -------------+------------------
         Factor1 |  0.9069   0.4214 
         Factor2 | -0.4214   0.9069 
    --------------------------------

. *rotate, promax
. predict f_joint*
(regression scoring assumed)

Scoring coefficients (method = regression; based on varimax rotated factors)

    ----------------------------------
        Variable |  Factor1   Factor2 
    -------------+--------------------
         asahosp |  0.40733   0.07257 
        betahosp |  0.34556  -0.15323 
         reper12 |  0.05128   0.25666 
         cabg30d |  0.10061   0.15267 
         latepci |  0.12850   0.20089 
        lidohosp | -0.08416   0.33563 
    ----------------------------------


. screeplot, mean

. estat factors

Factor analysis with different numbers of factors (maximum likelihood)

    ----------------------------------------------------------
    #factors |     loglik   df_m   df_r        AIC        BIC 
    ---------+------------------------------------------------
           1 |  -235.9146      6      9   483.8292    519.378 
           2 |  -5.782766     11      4   33.56553   98.73829 
           3 |  -1.308341     15      0   32.61668   121.4886 
    ----------------------------------------------------------
    the model with 3 factors is a Heywood case

. matrix list e(r_Phi)

symmetric e(r_Phi)[2,2]
         Factor1  Factor2
Factor1        1
Factor2        0        1

. corr f_joint* [aw=nobs]
(sum of wgt is   1.3985e+05)
(obs=2765)

             | f_joint1 f_joint2
-------------+------------------
    f_joint1 |   1.0000
    f_joint2 |   0.1153   1.0000


. /* look at correlation of common factor estimates across the methods */
. corr f_* $goodstuff $badstuff
(obs=2765)

             | f_level1 f_level2 f_joint1 f_joint2  asahosp betahosp  reper12  cabg30d  latepci lidohosp
-------------+------------------------------------------------------------------------------------------
    f_level1 |   1.0000
    f_level2 |   0.2062   1.0000
    f_joint1 |   0.9688   0.2954   1.0000
    f_joint2 |   0.1897   0.8428   0.1714   1.0000
     asahosp |   0.8778   0.2058   0.8627   0.2330   1.0000
    betahosp |   0.7749   0.0394   0.7600  -0.1499   0.4173   1.0000
     reper12 |   0.3793   0.3329   0.2949   0.6812   0.2391   0.1176   1.0000
     cabg30d |   0.1818   0.6580   0.3080   0.4064   0.1732   0.0939   0.1540   1.0000
     latepci |   0.2214   0.6631   0.3631   0.4917   0.2162   0.0977   0.2158   0.1484   1.0000
    lidohosp |  -0.0151   0.6066  -0.1215   0.7416  -0.0009  -0.1256   0.2767   0.1015   0.1095   1.0000


. /* TABLE 1A: CORRELATION BETWEEN FACTORS AND MEASURES IN CCP DATA, PATIENT WEIGHTED */
. corr f_joint1 f_joint2 $goodstuff $badstuff [aw=nobs]
(sum of wgt is   1.3985e+05)
(obs=2765)

             | f_joint1 f_joint2  asahosp betahosp  reper12  cabg30d  latepci lidohosp
-------------+------------------------------------------------------------------------
    f_joint1 |   1.0000
    f_joint2 |   0.1153   1.0000
     asahosp |   0.8594   0.2114   1.0000
    betahosp |   0.7732  -0.2273   0.4294   1.0000
     reper12 |   0.2069   0.6298   0.1895   0.0311   1.0000
     cabg30d |   0.3171   0.4087   0.1970   0.0923   0.1056   1.0000
     latepci |   0.3908   0.5134   0.2678   0.0930   0.1601   0.1709   1.0000
    lidohosp |  -0.1524   0.7554  -0.0177  -0.1851   0.2483   0.1298   0.1508   1.0000


. pwcorr f_joint1 f_joint2 $goodstuff $badstuff [aw=nobs], sig

             | f_joint1 f_joint2  asahosp betahosp  reper12  cabg30d  latepci
-------------+---------------------------------------------------------------
    f_joint1 |   1.0000 
             |
             |
    f_joint2 |   0.1153   1.0000 
             |   0.0000
             |
     asahosp |   0.8594   0.2114   1.0000 
             |   0.0000   0.0000
             |
    betahosp |   0.7732  -0.2273   0.4294   1.0000 
             |   0.0000   0.0000   0.0000
             |
     reper12 |   0.2069   0.6298   0.1895   0.0311   1.0000 
             |   0.0000   0.0000   0.0000   0.1023
             |
     cabg30d |   0.3171   0.4087   0.1970   0.0923   0.1056   1.0000 
             |   0.0000   0.0000   0.0000   0.0000   0.0000
             |
     latepci |   0.3908   0.5134   0.2678   0.0930   0.1601   0.1709   1.0000 
             |   0.0000   0.0000   0.0000   0.0000   0.0000   0.0000
             |
    lidohosp |  -0.1524   0.7554  -0.0177  -0.1851   0.2483   0.1298   0.1508 
             |   0.0000   0.0000   0.3522   0.0000   0.0000   0.0000   0.0000
             |

             | lidohosp
-------------+---------
    lidohosp |   1.0000 
             |
             |

. 
. 
. 
. /* construct quintiles & see how adoption varies by quintile */
. 
. foreach f in f_level1 f_level2 {
  2.  xtile `f'_5 = `f' [aw=nobs], nq(5)
  3.  foreach y in  $goodstuff $badstuff majteach black nobs {
  4.   tab `f'_5 [aw=nobs], summ(`y')
  5.   tab `f'_5, summ(`y')
  6.  }
  7. }

5 quantiles |            Summary of (mean) asahosp
of f_level1 |        Mean   Std. Dev.       Freq.        Obs.
------------+------------------------------------------------
          1 |   .65133717   .09444081       28007         784
          2 |   .76211612    .0553212       27938         524
          3 |   .81485849   .05534603       27984         484
          4 |   .85066724   .04649035       27951         445
          5 |   .90052562   .04336334       27967         528
------------+------------------------------------------------
      Total |   .79586262   .10530936      139847        2765

5 quantiles |      Summary of (mean) asahosp
of f_level1 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .63334361   .12298332         784
          2 |    .7662921   .06334843         524
          3 |   .81580568   .06198735         484
          4 |   .85227224   .05427674         445
          5 |   .90465643   .05568692         528
------------+------------------------------------
      Total |   .77752193   .13016905        2765

5 quantiles |           Summary of (mean) betahosp
of f_level1 |        Mean   Std. Dev.       Freq.        Obs.
------------+------------------------------------------------
          1 |   .30617346   .11630189       28007         784
          2 |   .39988546   .09951761       27938         524
          3 |   .45615352   .08907443       27984         484
          4 |   .52745877   .08718657       27951         445
          5 |   .64651196   .10555256       27967         528
------------+------------------------------------------------
      Total |   .46719629   .15261391      139847        2765

5 quantiles |     Summary of (mean) betahosp
of f_level1 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |    .2821962   .12785682         784
          2 |   .39279636   .10947501         524
          3 |   .45086522   .10402008         484
          4 |   .52111221   .09834151         445
          5 |    .6442037   .12257809         528
------------+------------------------------------
      Total |   .44026053   .17245053        2765

5 quantiles |            Summary of (mean) reper12
of f_level1 |        Mean   Std. Dev.       Freq.        Obs.
------------+------------------------------------------------
          1 |   .14785589   .07727573       28007         784
          2 |   .17624741   .06997992       27938         524
          3 |   .18867925   .07346938       27984         484
          4 |   .19949197   .07843649       27951         445
          5 |   .21421676   .09198367       27967         528
------------+------------------------------------------------
      Total |   .18528821   .08169339      139847        2765

5 quantiles |      Summary of (mean) reper12
of f_level1 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .13831231   .09195825         784
          2 |   .17750465   .08405036         524
          3 |   .19161977    .0895653         484
          4 |    .2054422   .08998288         445
          5 |   .23290593   .11299924         528
------------+------------------------------------
      Total |   .18393829   .10005239        2765

5 quantiles |            Summary of (mean) cabg30d
of f_level1 |        Mean   Std. Dev.       Freq.        Obs.
------------+------------------------------------------------
          1 |   .12464741   .07073522       28007         784
          2 |   .14224354   .06509896       27938         524
          3 |   .14826329   .07133362       27984         484
          4 |   .15416264   .06807603       27951         445
          5 |   .16172632   .07345824       27967         528
------------+------------------------------------------------
      Total |   .14620264   .07087216      139847        2765

5 quantiles |      Summary of (mean) cabg30d
of f_level1 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .11399653   .08286018         784
          2 |   .13605516   .07567997         524
          3 |   .13733724   .08109103         484
          4 |   .14533128   .07672202         445
          5 |    .1516368   .08770343         528
------------+------------------------------------
      Total |   .13449333   .08237744        2765

5 quantiles |            Summary of (mean) latepci
of f_level1 |        Mean   Std. Dev.       Freq.        Obs.
------------+------------------------------------------------
          1 |   .13114579   .07983204       28007         784
          2 |   .15566612    .0790157       27938         524
          3 |   .16920383   .08312456       27984         484
          4 |   .17666631   .08727551       27951         445
          5 |   .18990239   .08690768       27967         528
------------+------------------------------------------------
      Total |   .16450836   .08561606      139847        2765

5 quantiles |      Summary of (mean) latepci
of f_level1 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .12311134   .09025042         784
          2 |    .1489267   .08713214         524
          3 |   .15552373   .09061644         484
          4 |   .16277547   .09377145         445
          5 |   .17512707    .0993757         528
------------+------------------------------------
      Total |   .14999369   .09397761        2765

5 quantiles |           Summary of (mean) lidohosp
of f_level1 |        Mean   Std. Dev.       Freq.        Obs.
------------+------------------------------------------------
          1 |   .20505588   .10279526       28007         784
          2 |   .20484645   .08994062       27938         524
          3 |   .21855346   .09939379       27984         484
          4 |   .20714822   .09410611       27951         445
          5 |   .18246505   .09869353       27967         528
------------+------------------------------------------------
      Total |   .20361538   .09772566      139847        2765

5 quantiles |     Summary of (mean) lidohosp
of f_level1 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .20487746    .1135477         784
          2 |   .20679517   .10167032         524
          3 |   .21753695   .11397891         484
          4 |   .20606113   .10875513         445
          5 |   .19194029   .12975013         528
------------+------------------------------------
      Total |   .20517691   .11423316        2765

5 quantiles |           Summary of (mean) majteach
of f_level1 |        Mean   Std. Dev.       Freq.        Obs.
------------+------------------------------------------------
          1 |    .0526297   .22343566       28007         784
          2 |   .16565252   .37212367       27938         524
          3 |   .23059605   .42165015       27984         484
          4 |    .3021001    .4596852       27951         445
          5 |   .43415454   .49611544       27967         528
------------+------------------------------------------------
      Total |   .23698041   .42530709      139847        2765

5 quantiles |     Summary of (mean) majteach
of f_level1 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .04719388    .2121887         784
          2 |   .11641221   .32102505         524
          3 |   .15702479   .36420058         484
          4 |   .20898876   .40704396         445
          5 |       .3125   .46395196         528
------------+------------------------------------
      Total |    .1562387   .36314716        2765

5 quantiles |             Summary of (mean) black
of f_level1 |        Mean   Std. Dev.       Freq.        Obs.
------------+------------------------------------------------
          1 |   .05430785   .10273925       28007         784
          2 |   .05082683   .08013515       27938         524
          3 |   .05492424   .08468045       27984         484
          4 |   .05262781   .08309482       27951         445
          5 |   .05560124     .099806       27967         528
------------+------------------------------------------------
      Total |   .05365864   .09052498      139847        2765

5 quantiles |       Summary of (mean) black
of f_level1 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .06909205   .13005854         784
          2 |   .05224512   .09536573         524
          3 |   .05521752   .10372808         484
          4 |   .05554372   .10587674         445
          5 |   .07096359   .14720548         528
------------+------------------------------------
      Total |    .0616476   .11994803        2765

5 quantiles |             Summary of (count) nobs
of f_level1 |        Mean   Std. Dev.       Freq.        Obs.
------------+------------------------------------------------
          1 |   66.551826   55.559207       28007         784
          2 |   88.400172    68.20896       27938         524
          3 |   93.862207   62.876538       27984         484
          4 |   100.71944   63.869717       27951         445
          5 |   94.767798   65.802106       27967         528
------------+------------------------------------------------
      Total |   88.853254   64.448628      139847        2765

5 quantiles |       Summary of (count) nobs
of f_level1 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   35.723214   33.206982         784
          2 |   53.316794    43.29099         524
          3 |   57.818182   45.698082         484
          4 |   62.811236   48.851036         445
          5 |   52.967803   47.098356         528
------------+------------------------------------
      Total |   50.577577    44.00672        2765

5 quantiles |            Summary of (mean) asahosp
of f_level2 |        Mean   Std. Dev.       Freq.        Obs.
------------+------------------------------------------------
          1 |   .76036834   .12017789       28018         761
          2 |   .77935281   .10846179       27936         539
          3 |   .79906459   .10002682       28009         501
          4 |   .81178619   .09126721       27931         470
          5 |   .82881981   .08995023       27953         494
------------+------------------------------------------------
      Total |   .79586262   .10530936      139847        2765

5 quantiles |      Summary of (mean) asahosp
of f_level2 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .74670023   .15418195         761
          2 |   .76987459   .12281694         539
          3 |   .78010455   .11763747         501
          4 |   .79416935   .11085036         470
          5 |   .81488844   .11385847         494
------------+------------------------------------
      Total |   .77752193   .13016905        2765

5 quantiles |           Summary of (mean) betahosp
of f_level2 |        Mean   Std. Dev.       Freq.        Obs.
------------+------------------------------------------------
          1 |   .46041831   .16121435       28018         761
          2 |   .47014605   .15004366       27936         539
          3 |   .47852476   .15038691       28009         501
          4 |   .46024131   .14761587       27931         470
          5 |   .46664043   .15323039       27953         494
------------+------------------------------------------------
      Total |   .46719629   .15261391      139847        2765

5 quantiles |     Summary of (mean) betahosp
of f_level2 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .42751172   .18111706         761
          2 |   .44855185   .16863276         539
          3 |   .44710677   .16572741         501
          4 |    .4393306    .1665885         470
          5 |    .4447948   .17458317         494
------------+------------------------------------
      Total |   .44026053   .17245053        2765

5 quantiles |            Summary of (mean) reper12
of f_level2 |        Mean   Std. Dev.       Freq.        Obs.
------------+------------------------------------------------
          1 |   .15036762   .07937186       28018         761
          2 |   .17386168   .07486849       27936         539
          3 |    .1880824   .07503898       28009         501
          4 |    .2008163    .0778264       27931         470
          5 |   .21339391   .08621045       27953         494
------------+------------------------------------------------
      Total |   .18528821   .08169339      139847        2765

5 quantiles |      Summary of (mean) reper12
of f_level2 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .13997675   .09387355         761
          2 |   .17316657   .09015061         539
          3 |   .19370918   .09192625         501
          4 |    .2084068   .09392822         470
          5 |   .23022427   .10383584         494
------------+------------------------------------
      Total |   .18393829   .10005239        2765

5 quantiles |            Summary of (mean) cabg30d
of f_level2 |        Mean   Std. Dev.       Freq.        Obs.
------------+------------------------------------------------
          1 |   .08044828   .04472278       28018         761
          2 |   .12517898   .04842588       27936         539
          3 |   .14698847   .04925813       28009         501
          4 |   .16354588   .05522126       27931         470
          5 |   .21500376   .07424707       27953         494
------------+------------------------------------------------
      Total |   .14620264   .07087216      139847        2765

5 quantiles |      Summary of (mean) cabg30d
of f_level2 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .06921881   .05206662         761
          2 |    .1187761   .05659951         539
          3 |   .14385889   .05917386         501
          4 |   .16032004   .06587859         470
          5 |   .21812653   .09005608         494
------------+------------------------------------
      Total |   .13449333   .08237744        2765

5 quantiles |            Summary of (mean) latepci
of f_level2 |        Mean   Std. Dev.       Freq.        Obs.
------------+------------------------------------------------
          1 |   .08276822   .05026906       28018         761
          2 |   .12972509   .05402796       27936         539
          3 |   .16287622   .06215996       28009         501
          4 |   .20160395   .06984034       27931         470
          5 |   .24576969   .08134055       27953         494
------------+------------------------------------------------
      Total |   .16450836   .08561606      139847        2765

5 quantiles |      Summary of (mean) latepci
of f_level2 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .07512697    .0585945         761
          2 |   .12751648   .06545205         539
          3 |   .15600087   .06995143         501
          4 |   .19506674   .08039593         470
          5 |   .24087396   .09477494         494
------------+------------------------------------
      Total |   .14999369   .09397761        2765

5 quantiles |           Summary of (mean) lidohosp
of f_level2 |        Mean   Std. Dev.       Freq.        Obs.
------------+------------------------------------------------
          1 |    .1286316   .06651281       28018         761
          2 |   .16426833   .07021082       27936         539
          3 |   .19715092   .07315191       28009         501
          4 |   .23228671   .08127659       27931         470
          5 |    .2959253   .09965632       27953         494
------------+------------------------------------------------
      Total |   .20361538   .09772566      139847        2765

5 quantiles |     Summary of (mean) lidohosp
of f_level2 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .12915225   .08217487         761
          2 |   .17473602   .08397536         539
          3 |   .21136349   .08719787         501
          4 |    .2445059   .09448502         470
          5 |   .31181315   .12652278         494
------------+------------------------------------
      Total |   .20517691   .11423316        2765

5 quantiles |           Summary of (mean) majteach
of f_level2 |        Mean   Std. Dev.       Freq.        Obs.
------------+------------------------------------------------
          1 |    .2040474   .40326884       28018         761
          2 |   .24684994   .43157921       27936         539
          3 |   .29490521   .45645591       28009         501
          4 |   .22630769   .41888644       27931         470
          5 |   .21274997   .40966712       27953         494
------------+------------------------------------------------
      Total |   .23698041   .42530709      139847        2765

5 quantiles |     Summary of (mean) majteach
of f_level2 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .14191853   .34919607         761
          2 |   .17439703   .37980302         539
          3 |   .19361277   .39552386         501
          4 |   .13617021   .34333466         470
          5 |   .13967611   .34700208         494
------------+------------------------------------
      Total |    .1562387   .36314716        2765

5 quantiles |             Summary of (mean) black
of f_level2 |        Mean   Std. Dev.       Freq.        Obs.
------------+------------------------------------------------
          1 |   .06235277   .11898842       28018         761
          2 |   .05079467   .08925572       27936         539
          3 |   .05173337   .08115069       28009         501
          4 |   .05234327   .08098989       27931         470
          5 |   .05104998   .07518716       27953         494
------------+------------------------------------------------
      Total |   .05365864   .09052498      139847        2765

5 quantiles |       Summary of (mean) black
of f_level2 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .07811074   .15482228         761
          2 |   .05632068   .10603712         539
          3 |    .0587013   .09893571         501
          4 |   .05472867   .10040751         470
          5 |   .05166939   .10639542         494
------------+------------------------------------
      Total |    .0616476   .11994803        2765

5 quantiles |             Summary of (count) nobs
of f_level2 |        Mean   Std. Dev.       Freq.        Obs.
------------+------------------------------------------------
          1 |   62.926619   42.752037       28018         761
          2 |   84.068514    57.29241       27936         539
          3 |   89.423864   54.387855       28009         501
          4 |   106.64233   81.020773       27931         470
          5 |   101.27518   70.769065       27953         494
------------+------------------------------------------------
      Total |   88.853254   64.448628      139847        2765

5 quantiles |       Summary of (count) nobs
of f_level2 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   36.817346   31.024812         761
          2 |   51.829314   40.915052         539
          3 |   55.906188   43.331203         501
          4 |    59.42766   53.026787         470
          5 |    56.58502   50.338085         494
------------+------------------------------------
      Total |   50.577577    44.00672        2765

. drop f_level1_5 f_level2_5

. 
. /* keep provider f_level* f_ln* f_ln_cox* nobs */
. keep provider f_level* f_joint* $goodstuff $badstuff rl6inab nobs

. sort provider

. save ccp_factors_hosp, replace
file ccp_factors_hosp.dta saved

. 
. 
. /* now merge fe & factor data at hospital level */
. /* first make aha ownership data */
. clear all

. use aha94

. gen provider=real(hcfaid)

. drop hcfaid

. gen forprof=(cntrl>=31 & cntrl<=33)

. gen govt=((cntrl>=11 & cntrl<=16)|(cntrl>=41 & cntrl<=48))

. sort provider

. save aha94_1, replace
file aha94_1.dta saved

. 
. /*  first merge on hrr */
. *use "/Volumes/jss/Staiger Productivity/fe_ami_hosp_86_12apr", clear
. use "/Volumes/JSS/Staiger Productivity/fe_ami_hosp_86_nov07", clear

. destring provider, replace
provider has all characters numeric; replaced as long

. sort provider

. merge provider using hosp94_jon_fixed
(note: you are using old merge syntax; see [D] merge for new syntax)
variable provider does not uniquely identify observations in the master data
provider was long now double

. tab _merge

     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |      2,204        3.90        3.90
          2 |      2,901        5.14        9.04
          3 |     51,357       90.96      100.00
------------+-----------------------------------
      Total |     56,462      100.00

. drop if _merge==2
(2901 observations deleted)

. drop _merge

. 
. /* merge on the ccp hospital data */
. sort provider

. merge provider using ccp_factors_hosp
(note: you are using old merge syntax; see [D] merge for new syntax)
variable provider does not uniquely identify observations in the master data

. tab _merge

     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |      1,026        1.92        1.92
          3 |     52,535       98.08      100.00
------------+-----------------------------------
      Total |     53,561      100.00

. keep if _merge==3
(1026 observations deleted)

. drop _merge

. /* merge on hospital ownership */
. sort provider

. merge provider using aha94_1
(note: you are using old merge syntax; see [D] merge for new syntax)
variable provider does not uniquely identify observations in the master data
variable provider does not uniquely identify observations in aha94_1.dta

. tab _merge

     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |      2,280        4.07        4.07
          2 |      3,431        6.13       10.20
          3 |     50,255       89.80      100.00
------------+-----------------------------------
      Total |     55,966      100.00

. drop if _merge==2
(3431 observations deleted)

. drop _merge

. * merge on drug-eluting stent data
. sort provider

. merge provider using des_rates
(note: you are using old merge syntax; see [D] merge for new syntax)
variable provider does not uniquely identify observations in the master data

. tab _merge

     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |     32,490       61.73       61.73
          2 |         95        0.18       61.91
          3 |     20,045       38.09      100.00
------------+-----------------------------------
      Total |     52,630      100.00

. drop if _merge==2
(95 observations deleted)

. drop _merge

. 
. /* construct quintiles & see how adoption varies by quintile */
. 
. foreach f in f_level1 f_joint1 f_joint2 avdif {
  2.  xtile `f'_5 = `f' [aw=nobs_], nq(5)
  3.  tab `f'_5
  4.  tab `f'_5 [aw=nobs_]
  5. }

5 quantiles |
of f_level1 |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |     15,067       28.68       28.68
          2 |     10,602       20.18       48.86
          3 |      9,253       17.61       66.47
          4 |      8,493       16.17       82.64
          5 |      9,120       17.36      100.00
------------+-----------------------------------
      Total |     52,535      100.00

5 quantiles |
of f_level1 |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |10,561.3212       20.10       20.10
          2 | 10,463.178       19.92       40.02
          3 | 10,504.582       20.00       60.02
          4 | 10,514.485       20.01       80.03
          5 | 10,491.434       19.97      100.00
------------+-----------------------------------
      Total |     52,535      100.00

5 quantiles |
of f_joint1 |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |     15,466       29.44       29.44
          2 |     10,754       20.47       49.91
          3 |      9,424       17.94       67.85
          4 |      9,006       17.14       84.99
          5 |      7,885       15.01      100.00
------------+-----------------------------------
      Total |     52,535      100.00

5 quantiles |
of f_joint1 |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 | 10,538.422       20.06       20.06
          2 | 10,484.285       19.96       40.02
          3 |  10,507.26       20.00       60.02
          4 | 10,512.749       20.01       80.03
          5 | 10,492.283       19.97      100.00
------------+-----------------------------------
      Total |     52,535      100.00

5 quantiles |
of f_joint2 |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |     13,433       25.57       25.57
          2 |     10,355       19.71       45.28
          3 |      9,367       17.83       63.11
          4 |      9,120       17.36       80.47
          5 |     10,260       19.53      100.00
------------+-----------------------------------
      Total |     52,535      100.00

5 quantiles |
of f_joint2 |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 | 10,557.775       20.10       20.10
          2 | 10,475.948       19.94       40.04
          3 |  10,503.79       19.99       60.03
          4 |10,490.5667       19.97       80.00
          5 | 10,506.921       20.00      100.00
------------+-----------------------------------
      Total |     52,535      100.00

5 quantiles |
  of avdif  |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |      5,130       25.59       25.59
          2 |      3,990       19.91       45.50
          3 |      3,819       19.05       64.55
          4 |      3,591       17.91       82.46
          5 |      3,515       17.54      100.00
------------+-----------------------------------
      Total |     20,045      100.00

5 quantiles |
  of avdif  |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 | 4,102.5603       20.47       20.47
          2 | 3,934.7665       19.63       40.10
          3 | 4,007.5301       19.99       60.09
          4 |4,036.31979       20.14       80.23
          5 | 3,963.8233       19.77      100.00
------------+-----------------------------------
      Total |     20,045      100.00

. 
. 
. /* save the final analysis dataset */
. save analysis_1986_2_2014, replace
file analysis_1986_2_2014.dta saved

. /* create data with just the quintiles, to merge back below */
. keep provider f_level1_5 f_joint1_5 f_joint2_5

. collapse (mean) f_level1_5 f_joint1_5 f_joint2_5, by(provider)

. save analysis_quintiles, replace
file analysis_quintiles.dta saved

. 
. /* create means by quintile for table 1a */
. use ccp_temp, clear

. keep provider admdate hrr majteach asahosp betahosp reper12 cabg30d latepci lidohosp

. gen year=1994 if admdate<12784
(53925 missing values generated)

. replace year=1995 if admdate>=12784
(53925 real changes made)

. tab year, m

       year |      Freq.     Percent        Cum.
------------+-----------------------------------
       1994 |     86,056       61.48       61.48
       1995 |     53,925       38.52      100.00
------------+-----------------------------------
      Total |    139,981      100.00

. * Merge income data
. sort hrr

. merge hrr using "/Volumes/jss/Staiger Productivity/hrr_names.dta"
(note: you are using old merge syntax; see [D] merge for new syntax)
variable hrr does not uniquely identify observations in the master data

. tab _merge 

     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          3 |    139,981      100.00      100.00
------------+-----------------------------------
      Total |    139,981      100.00

. drop _merge

. rename hrrstate state

. sort state year

. merge state year using "/Volumes/jss/Staiger Productivity/state_year_inc.dta"
(note: you are using old merge syntax; see [D] merge for new syntax)
variables state year do not uniquely identify observations in the master data

. tab _merge

     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          2 |        938        0.67        0.67
          3 |    139,981       99.33      100.00
------------+-----------------------------------
      Total |    140,919      100.00

. drop if _merge==2
(938 observations deleted)

. drop _merge

. /* merge on hospital ownership */
. sort provider

. merge provider using aha94_1
(note: you are using old merge syntax; see [D] merge for new syntax)
variable provider does not uniquely identify observations in the master data
variable provider does not uniquely identify observations in aha94_1.dta

. tab _merge

     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |      8,196        5.72        5.72
          2 |      3,385        2.36        8.08
          3 |    131,785       91.92      100.00
------------+-----------------------------------
      Total |    143,366      100.00

. drop if _merge==2
(3385 observations deleted)

. drop _merge

. * merge on drug-eluting stent data
. sort provider

. merge provider using des_rates
(note: you are using old merge syntax; see [D] merge for new syntax)
variable provider does not uniquely identify observations in the master data

. tab _merge

     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |     60,527       43.21       43.21
          2 |         92        0.07       43.28
          3 |     79,454       56.72      100.00
------------+-----------------------------------
      Total |    140,073      100.00

. drop if _merge==2
(92 observations deleted)

. drop _merge

. gen has_avdif=(avdif!=.)

. * merge on quintiles
. sort provider

. merge provider using analysis_quintiles
(note: you are using old merge syntax; see [D] merge for new syntax)
variable provider does not uniquely identify observations in the master data

. tab _merge

     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |        134        0.10        0.10
          3 |    139,847       99.90      100.00
------------+-----------------------------------
      Total |    139,981      100.00

. drop if _merge==2
(0 observations deleted)

. drop _merge

. egen nobs=count(provider), by(provider)

. 
. foreach y in $goodstuff $badstuff nobs majteach forprof govt income has_avdif avdif {
  2.   tab f_level1_5, summ(`y')
  3.   tab f_joint1_5, summ(`y')
  4.   tab f_joint2_5, summ(`y')
  5.  }

     (mean) |        Summary of asa during
 f_level1_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |     .654411   .47556818       28803
          2 |   .76333425   .42504265       29248
          3 |   .81984371   .38432429       28664
          4 |   .85522409   .35188098       28292
          5 |   .90289855   .29610182       24840
------------+------------------------------------
      Total |   .79586262    .4030713      139847

     (mean) |        Summary of asa during
 f_joint1_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |     .653985   .47570629       28808
          2 |   .76807291    .4220699       29298
          3 |   .81494081   .38835231       28807
          4 |   .85693179   .35014855       28427
          5 |   .90259926   .29650873       24507
------------+------------------------------------
      Total |   .79586262    .4030713      139847

     (mean) |        Summary of asa during
 f_joint2_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .75845662   .42802633       28794
          2 |   .78781318   .40886345       29097
          3 |   .80130305   .39902657       27781
          4 |   .81331897   .38966225       27855
          5 |   .82146657   .38296843       26320
------------+------------------------------------
      Total |   .79586262    .4030713      139847

     (mean) |   Summary of beta blocker during
 f_level1_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .30625282   .46094404       28803
          2 |   .40683124   .49125129       29248
          3 |   .45879849   .49830824       28664
          4 |   .53421462    .4988368       28292
          5 |   .65825282   .47430486       24840
------------+------------------------------------
      Total |   .46719629   .49892454      139847

     (mean) |   Summary of beta blocker during
 f_joint1_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .31432241    .4642535       28808
          2 |   .40115366   .49014039       29298
          3 |   .46693512   .49891418       28807
          4 |   .52977803   .49912126       28427
          5 |   .65356837   .47584241       24507
------------+------------------------------------
      Total |   .46719629   .49892454      139847

     (mean) |   Summary of beta blocker during
 f_joint2_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |    .5065986   .49996514       28794
          2 |   .49005052   .49990959       29097
          3 |   .48025629   .49961903       27781
          4 |   .44681386   .49717211       27855
          5 |   .40661094   .49121039       26320
------------+------------------------------------
      Total |   .46719629   .49892454      139847

     (mean) |         Summary of reper12
 f_level1_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .14887338    .3559698       28803
          2 |   .17549918   .38040001       29248
          3 |   .19051772   .39271631       28664
          4 |    .2008695   .40065773       28292
          5 |   .21525765   .41100924       24840
------------+------------------------------------
      Total |   .18528821   .38853258      139847

     (mean) |         Summary of reper12
 f_joint1_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .15162455   .35866281       28808
          2 |     .185883   .38901886       29298
          3 |   .19481376   .39606414       28807
          4 |   .20142822   .40107425       28427
          5 |   .19423022     .395615       24507
------------+------------------------------------
      Total |   .18528821   .38853258      139847

     (mean) |         Summary of reper12
 f_joint2_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .11592693   .32014284       28794
          2 |   .15981029   .36643632       29097
          3 |   .18775422   .39052281       27781
          4 |   .20746724   .40550029       27855
          5 |   .26325988   .44041059       26320
------------+------------------------------------
      Total |   .18528821   .38853258      139847

            |   Summary of cabg within 30 days
     (mean) |              (part b)
 f_level1_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .12616741   .33204371       28803
          2 |   .14243709   .34950385       29248
          3 |   .14868825   .35578711       28664
          4 |    .1550615    .3619697       28292
          5 |   .16090982   .36745515       24840
------------+------------------------------------
      Total |   .14620264   .35331051      139847

            |   Summary of cabg within 30 days
     (mean) |              (part b)
 f_joint1_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |    .1156276   .31978338       28808
          2 |   .13260291   .33915086       29298
          3 |   .14746416   .35457417       28807
          4 |   .16318993   .36954537       28427
          5 |   .17721467   .38185807       24507
------------+------------------------------------
      Total |   .14620264   .35331051      139847

            |   Summary of cabg within 30 days
     (mean) |              (part b)
 f_joint2_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .10328541   .30433657       28794
          2 |   .13623398   .34304274       29097
          3 |   .14560311   .35271422       27781
          4 |   .16585891   .37196062       27855
          5 |   .18400456   .38749527       26320
------------+------------------------------------
      Total |   .14620264   .35331051      139847

     (mean) |         Summary of latepci
 f_level1_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .13168767   .33815677       28803
          2 |   .15587391   .36274196       29248
          3 |   .16941111   .37512117       28664
          4 |    .1796621   .38391254       28292
          5 |   .18981481   .39216239       24840
------------+------------------------------------
      Total |   .16450836   .37073756      139847

     (mean) |         Summary of latepci
 f_joint1_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .11715496   .32161042       28808
          2 |    .1483719   .35547432       29298
          3 |   .16423092   .37049141       28807
          4 |   .18197488   .38583061       28427
          5 |   .21952911   .41393607       24507
------------+------------------------------------
      Total |   .16450836   .37073756      139847

     (mean) |         Summary of latepci
 f_joint2_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .10252136   .30333797       28794
          2 |   .14046122   .34747088       29097
          3 |   .16475289   .37096405       27781
          4 |   .19479447   .39604951       27855
          5 |   .22659574    .4186368       26320
------------+------------------------------------
      Total |   .16450836   .37073756      139847

     (mean) |     Summary of lidocaine during
 f_level1_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .20504809   .40374376       28803
          2 |   .20548414   .40406186       29248
          3 |   .21752023    .4125665       28664
          4 |   .20853952   .40627161       28292
          5 |   .17809984   .38260447       24840
------------+------------------------------------
      Total |   .20361538   .40268762      139847

     (mean) |     Summary of lidocaine during
 f_joint1_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .21348237   .40977247       28808
          2 |   .21574852   .41134763       29298
          3 |   .21446176   .41045556       28807
          4 |   .19506103   .39625465       28427
          5 |   .17468478   .37970501       24507
------------+------------------------------------
      Total |   .20361538   .40268762      139847

     (mean) |     Summary of lidocaine during
 f_joint2_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .11415573   .31800583       28794
          2 |   .15578926   .36266167       29097
          3 |   .20215255   .40161263       27781
          4 |   .23902351   .42649479       27855
          5 |   .31842705   .46587499       26320
------------+------------------------------------
      Total |   .20361538   .40268762      139847

     (mean) |           Summary of nobs
 f_level1_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   69.273583   59.787513       28803
          2 |   86.230648   65.273673       29248
          3 |   94.466857   61.627391       28664
          4 |     103.788   66.372896       28292
          5 |   91.156683   63.771588       24840
------------+------------------------------------
      Total |   88.853254   64.437203      139847

     (mean) |           Summary of nobs
 f_joint1_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   64.021105   53.861508       28808
          2 |   86.923749   68.111673       29298
          3 |    94.01642   62.447805       28807
          4 |   98.369332   62.517418       28427
          5 |   103.24287    67.43793       24507
------------+------------------------------------
      Total |   88.853254   64.437203      139847

     (mean) |           Summary of nobs
 f_joint2_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |    77.30041   58.061726       28794
          2 |   82.186102   47.650742       29097
          3 |   94.666823   70.131186       27781
          4 |   107.08989   75.204989       27855
          5 |    83.42614   63.834956       26320
------------+------------------------------------
      Total |   88.853254   64.437203      139847

     (mean) | Summary of major teaching hospital
 f_level1_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .06370864   .24423743       28803
          2 |   .16072894   .36728703       29248
          3 |   .24448786   .42979064       28664
          4 |   .30043829   .45845671       28292
          5 |   .44673913   .49716519       24840
------------+------------------------------------
      Total |   .23698041   .42523169      139847

     (mean) | Summary of major teaching hospital
 f_joint1_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .05335324   .22474079       28808
          2 |   .15642706   .36326593       29298
          3 |    .2253966    .4178505       28807
          4 |   .28975974   .45365876       28427
          5 |   .50153018   .50000786       24507
------------+------------------------------------
      Total |   .23698041   .42523169      139847

     (mean) | Summary of major teaching hospital
 f_joint2_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .28155171   .44976368       28794
          2 |   .28006324   .44903758       29097
          3 |   .25992585   .43860156       27781
          4 |   .24483935   .42999963       27855
          5 |   .10805471    .3104554       26320
------------+------------------------------------
      Total |   .23698041   .42523169      139847

     (mean) |         Summary of forprof
 f_level1_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .16818429   .37403664       27565
          2 |   .08707048   .28194338       27851
          3 |   .06506286   .24664135       26728
          4 |   .07981096   .27100544       26450
          5 |   .04492433   .20714245       23061
------------+------------------------------------
      Total |   .09074475   .28724687      131655

     (mean) |         Summary of forprof
 f_joint1_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .15780303   .36456283       27547
          2 |   .08211385   .27454301       27949
          3 |   .07648621   .26577937       27116
          4 |   .08776201   .28295386       26287
          5 |   .04060468   .19737692       22756
------------+------------------------------------
      Total |   .09074475   .28724687      131655

     (mean) |         Summary of forprof
 f_joint2_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |    .0790387   .26980419       26797
          2 |   .06771977   .25126892       27791
          3 |   .07419586   .26209432       26457
          4 |   .09785767   .29712786       25813
          5 |   .13945235   .34642493       24797
------------+------------------------------------
      Total |   .09074475   .28724687      131655

     (mean) |           Summary of govt
 f_level1_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .17141302   .37687631       27565
          2 |   .10383828   .30505612       27851
          3 |   .12717001   .33316955       26728
          4 |   .09160681   .28847555       26450
          5 |   .11491262   .31892338       23061
------------+------------------------------------
      Total |   .12220577   .32752455      131655

     (mean) |           Summary of govt
 f_joint1_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .17283189   .37810874       27547
          2 |   .10841175   .31090529       27949
          3 |   .12498156    .3307041       27116
          4 |    .1034732   .30458172       26287
          5 |   .09619441   .29486415       22756
------------+------------------------------------
      Total |   .12220577   .32752455      131655

     (mean) |           Summary of govt
 f_joint2_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .13467926   .34138703       26797
          2 |   .09963657   .29952021       27791
          3 |   .11271119   .31624541       26457
          4 |   .13016697   .33649356       25813
          5 |   .13586321   .34265016       24797
------------+------------------------------------
      Total |   .12220577   .32752455      131655

     (mean) |          Summary of income
 f_level1_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   41729.687    5582.297       28803
          2 |   42204.485   5313.0984       29248
          3 |   42181.632   5372.5084       28664
          4 |   42534.789   5136.0875       28292
          5 |   44039.718   5145.9511       24840
------------+------------------------------------
      Total |   42494.813    5372.176      139847

     (mean) |          Summary of income
 f_joint1_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   41767.975   5608.9811       28808
          2 |    42311.57   5279.9964       29298
          3 |   42142.097   5106.4093       28807
          4 |   42491.768   5305.7148       28427
          5 |   43986.413   5295.8833       24507
------------+------------------------------------
      Total |   42494.813    5372.176      139847

     (mean) |          Summary of income
 f_joint2_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   43647.163   5627.9037       28794
          2 |   43161.806   5610.1164       29097
          3 |   42111.986   5279.2911       27781
          4 |   42048.902   4994.8651       27855
          5 |   41372.772   4951.1199       26320
------------+------------------------------------
      Total |   42494.813    5372.176      139847

     (mean) |        Summary of has_avdif
 f_level1_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |    .3217026   .46713768       28803
          2 |   .49305935   .49996037       29248
          3 |   .62656991   .48372329       28664
          4 |   .68892266   .46294255       28292
          5 |   .73691626   .44031635       24840
------------+------------------------------------
      Total |   .56807082   .49534646      139847

     (mean) |        Summary of has_avdif
 f_joint1_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .27634685   .44719818       28808
          2 |   .49945389   .50000823       29298
          3 |   .61335786   .48698894       28807
          4 |   .67548457   .46820175       28427
          5 |   .81519566   .38814668       24507
------------+------------------------------------
      Total |   .56807082   .49534646      139847

     (mean) |        Summary of has_avdif
 f_joint2_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .31023824   .46259908       28794
          2 |   .48128673   .49965828       29097
          3 |   .60026637   .48985232       27781
          4 |   .72188117    .4480803       27855
          5 |   .74931611   .43341506       26320
------------+------------------------------------
      Total |   .56807082   .49534646      139847

     (mean) |       Summary of (mean) avdif
 f_level1_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .51937915   .20414692        9266
          2 |    .5663253   .21439472       14421
          3 |   .59189047   .20182311       17960
          4 |   .60452023   .19941383       19491
          5 |   .62428051   .19876721       18305
------------+------------------------------------
      Total |   .58935407   .20561484       79443

     (mean) |       Summary of (mean) avdif
 f_joint1_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |   .50803179    .2112588        7961
          2 |   .56491216   .21203145       14633
          3 |   .58921061    .2032792       17669
          4 |   .60541132   .19357057       19202
          5 |   .62435603   .20076169       19978
------------+------------------------------------
      Total |   .58935407   .20561484       79443

     (mean) |       Summary of (mean) avdif
 f_joint2_5 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |    .6071942   .20183071        8933
          2 |   .60584342     .204116       14004
          3 |   .60012838   .19743669       16676
          4 |   .60161194   .19850319       20108
          5 |   .54795684   .21641464       19722
------------+------------------------------------
      Total |   .58935407   .20561484       79443

.  
. log close
      name:  <unnamed>
       log:  /Volumes/JSS/Staiger Productivity/stage2_hosp_may2014.log
  log type:  text
 closed on:  25 Nov 2014, 11:58:23
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
